/*********************************************************
          File Name:pisces_signal.c
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 24 Apr 2015 10:07:24 PM CST
**********************************************************/

#include "pisces_signal.h"

void pisces_signal(pisces_signal_t * sig, void (*handler) (int))
{
    sigemptyset(&sig->sa.sa_mask);
    sigaddset(&sig->sa.sa_mask, sig->signo);

    sig->sa.sa_flags = 0;
    sig->sa.sa_handler = handler;

    sigaction(sig->signo, &sig->sa, NULL);
}
